package com.example.gaojt.androiddemo.intentCover;

import android.app.Activity;
import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;

/**
 * Created by gaojt on 6/13/17.
 */

public class IntentToUri extends Activity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // Intent intent = new Intent("com.tcl.action.apps.appInfo");
        Intent intent = new Intent();
        intent.putExtra("appPkg", "com.surpax.ledflashlight.panel");
        intent.setComponent(new ComponentName("com.tcl.live", "com.tcl.live.activity.appinfo.AppInfoActivity"));
        String uri = intent.toUri(Intent.URI_INTENT_SCHEME);
        Log.d("aac", "onCreate 1: uri = " + uri);
        Intent uriToIntent = new Intent(IntentToUri.this, UriToIntent.class);
        uriToIntent.putExtra("uri", uri);

        startActivity(uriToIntent);
        // uri = intent.toUri(Intent.URI_ANDROID_APP_SCHEME);
        // Log.d("aac", "onCreate 2: uri = " + uri);

    }
}
